public class DecimalOneCount {

    public static void main(String[] args){
        judge(111);
    }
    
    private static void judge(int n){
        int result = 0;
        for(int i = n; i >= 0; i --){
            result += eachJudge(i);
        }
        System.out.println(result);
    }
    private static int eachJudge(int n){
        int count = 0;
        while(n > 0){
            int f = n % 10;
            if(f == 1){
                count ++;
            }
            n /= 10;
        }
        return count;
    }
}